package org.boyan.modules.cgform.util;

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;

class e {
    private static String b() {
        String str = "";
        byte[] arrayOfByte = null;
        try {
            InetAddress inetAddress = InetAddress.getLocalHost();
            arrayOfByte = NetworkInterface.getByInetAddress(inetAddress).getHardwareAddress();
        } catch (Exception exception) {
            return null;
        }
        StringBuilder stringBuffer = new StringBuilder("");
        if (arrayOfByte == null)
            return null;
        for (byte b = 0; b < arrayOfByte.length; b++) {
            if (b != 0)
                stringBuffer.append("-");
            int i = arrayOfByte[b] & 0xFF;
            String str1 = Integer.toHexString(i);
            if (str1.length() == 1) {
                stringBuffer.append("0").append(str1);
            } else {
                stringBuffer.append(str1);
            }
        }
        str = stringBuffer.toString().toUpperCase();
        if ("".equals(str))
            return null;
        return str;
    }

    private static String c() {
        String str = "";
        try {
            Enumeration<NetworkInterface> enumeration = NetworkInterface.getNetworkInterfaces();
            while (enumeration.hasMoreElements()) {
                byte[] arrayOfByte = ((NetworkInterface)enumeration.nextElement()).getHardwareAddress();
                if (arrayOfByte == null)
                    continue;
                StringBuilder stringBuilder = new StringBuilder();
                for (byte b : arrayOfByte) {
                    stringBuilder.append(a(b));
                    stringBuilder.append("-");
                }
                stringBuilder.deleteCharAt(stringBuilder.length() - 1);
                str = stringBuilder.toString().toUpperCase();
            }
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        return str;
    }

    private static String a(byte paramByte) {
        String str = "000000" + Integer.toHexString(paramByte);
        return str.substring(str.length() - 2);
    }

    private static String d() {
        return System.getProperty("os.name").toLowerCase();
    }

    public static String a() {
        String str1 = d();
        String str2 = null;
        if (str1.startsWith("windows")) {
            str2 = b();
        } else {
            str2 = c();
        }
        return str2;
    }
}
